package com.bff.gaia.streaming.api.mo.gaia.network.server;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.Socket;

public abstract class AServerThread extends Thread {
	Socket client;
	Server server;

	public AServerThread() {
	}

	public AServerThread(Socket client, Server server) {
		this.server = server;
		this.client = client;
	}

	public void run() {
		try {
			BufferedOutputStream out = new BufferedOutputStream(this.client.getOutputStream());
			BufferedInputStream in = new BufferedInputStream(this.client.getInputStream());
			this.dojob(in,out);
			this.client.close();
		} catch (IOException var14) {
			System.out.println("IOException occurred .");
			var14.printStackTrace();
		}

	}

	public abstract void dojob(BufferedInputStream in, BufferedOutputStream out) throws IOException;

	public void setClient(Socket client) {
		this.client = client;
	}

	public void setServer(Server server) {
		this.server = server;
	}

	public Socket getClient() {
		return client;
	}

	public Server getServer() {
		return server;
	}
}